package com.gc.services.impl;

import ch.qos.logback.core.net.server.Client;
import com.gc.dao.custom.ClientMapper;
import com.gc.dto.ClientDTO;
import com.gc.pojo.SysClient;
import com.gc.services.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xyl
 * @create 2020/8/7 17:13
 * @desc
**/
@Service
public class ClientServiceImpl implements ClientService {
    @Autowired
    private ClientMapper clientMapper;

    @Override
    public SysClient getClientByWtdw(String wtDw) {
        return clientMapper.selectClientByWtdw(wtDw);
    }

    @Override
    public int addClient(SysClient client) {
        //warn 注意返回主键id
        return clientMapper.insertSelective(client);
    }

    @Override
    public List<ClientDTO> getAllClientDTO() {
        return clientMapper.selectAllClientDTO();
    }

    @Override
    public int remove(Integer clientId) {
        return clientMapper.deleteByPrimaryKey(clientId);
    }

    @Override
    public List<SysClient> getAllClient() {
        return clientMapper.selectAllClient();
    }

    @Override
    public SysClient getClientById(Integer clientId) {
        return clientMapper.selectByPrimaryKey(clientId);
    }

    @Override
    public int modify(SysClient client) {
        return clientMapper.updateByPrimaryKeySelective(client);
    }

    @Override
    public SysClient getClientByUserId(Integer userId) {
        return clientMapper.selectByUserId(userId);
    }
}
